﻿namespace Text2Rss.Tests.Helpers
{
	using System;
	using NHibernate;
	using Text2Rss.Web.Models;

	public class StructureHelper
	{
		public StructureHelper()
		{
			Initialize();
		}

		public User User { get; set; }

		public SourceFile SourceFile { get; set; }

		public Feed Feed { get; set; }

		public Post Post { get; set; }

		public void Initialize()
		{
			User = new User
			{
				Email = "email",
				Name = "Fio",
				IsAdmin = true,
				PasswordHash = "sdf"
			};

			SourceFile = new SourceFile
			{
				Title = "title",
				Author = "author"
			};

			Feed = new Feed
			{
				Owner = User,
				SourceFile = SourceFile,
				CurrentPosition = 0,
				PostSize = 10,
				PublishInterval = 1
			};

			Post = new Post
			{
				Feed = Feed,
				DateTime = DateTime.Now.Date,
				Content = "Content"
			};
		}

		public void Save(ISession session)
		{
			session.Save(User);
			session.Save(SourceFile);
			session.Save(Feed);
			session.Save(Post);
		}
	}
}
